package zqkcom.atguigu.service.impl;

import zqkcom.atguigu.bean.User;
import zqkcom.atguigu.dao.UserDao;
import zqkcom.atguigu.dao.impl.UserDaoImpl;
import zqkcom.atguigu.service.UserService;

public class UserServiceImpl implements UserService {
    UserDao userDao = new UserDaoImpl();
    @Override
    public User login(String username, String password) {

        return userDao.login(username, password);
    }

    @Override
    public boolean regist(User user) {
        User userBySQL = userDao.checkUsername(user.getUsername());
        if (userBySQL == null) {
            userDao.registUser(user);
            return true;
        } else {
            return false;
        }



    }
}
